switch (state) {
  case 0:
    LOAD(linkUrl);
  case 1:
    // locate image using CSS selector
    var selector = "img[foo='bar']";
    var image = document.querySelector(selector);
    RETURN(image.src);
}